package com.wonder.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wonder.app.domain.PrdSuffix;
import com.wonder.app.mapper.PrdSuffixDao;
import com.wonder.app.service.PrdSuffixService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PrdSuffixServiceImpl extends ServiceImpl<PrdSuffixDao, PrdSuffix> implements PrdSuffixService {
    /**
     * 查询后缀信息
     * @param map
     * @param user_id
     * @return
     */
    @Override
    public Map<String, Object> selectSuffix(Map<String, Object> map, Long user_id) {
        List<PrdSuffix> prdSuffixes = this.baseMapper.selectList(new LambdaQueryWrapper<>());
        List<Map<String,Object>> dataList = new ArrayList<>();
        for (PrdSuffix prdSuffix : prdSuffixes){
            Map<String,Object> suMap = new HashMap<>();
            suMap.put("text",prdSuffix.getSuffix());
            suMap.put("value",prdSuffix.getSuffix());
            dataList.add(suMap);
        }
        Map<String,Object> data = new HashMap<>();
        data.put("dataList",dataList);
        return data;
    }
}
